package com.ruoyi.ruoyimaintenance.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.ruoyimaintenance.domain.entity.MaintenanceDeviceConfig;
import com.ruoyi.ruoyimaintenance.mapper.MaintenanceDeviceConfigMapper;
import com.ruoyi.ruoyimaintenance.service.MaintenanceDeviceConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MaintenanceDeviceConfigServiceImpl implements MaintenanceDeviceConfigService {

    @Autowired
    MaintenanceDeviceConfigMapper maintenanceDeviceConfigMapper;

    @Override
    public PageInfo<MaintenanceDeviceConfig> maintenanceDeviceConfigBySearch(Integer pageNub,Integer pageSize,Integer line, String machineNumber, String headNumber) {
        PageHelper.startPage(pageNub,pageSize);
        List<MaintenanceDeviceConfig> maintenanceDeviceConfigs = maintenanceDeviceConfigMapper.maintenanceDeviceConfigBySearch(line, machineNumber, headNumber);
        PageInfo<MaintenanceDeviceConfig> pageInfo=new PageInfo<>(maintenanceDeviceConfigs);
        return pageInfo;

    }

    @Override
    public int addMaintenanceDeviceConfig(MaintenanceDeviceConfig maintenanceDeviceConfig) {
        return maintenanceDeviceConfigMapper.addMaintenanceDeviceConfig(maintenanceDeviceConfig);
    }

    @Override
    public int updateMaintenanceDeviceConfig(MaintenanceDeviceConfig maintenanceDeviceConfig) {
        return maintenanceDeviceConfigMapper.updateMaintenanceDeviceConfig(maintenanceDeviceConfig);
    }

    @Override
    public int deleteMaintenanceDeviceConfig(Long id) {
        return maintenanceDeviceConfigMapper.deleteMaintenanceDeviceConfig(id);
    }
}
